package me.yobol.lintcode.easy.clonebt;

import me.yobol.lintcode.TreeNode;

/**
 *
 * @author Yobol
 */
public class Main {
    public static void main(String[] args){
        TreeNode node1 = new TreeNode(1);
        TreeNode node2 = new TreeNode(2);
        node1.left = node2;
        TreeNode node3 = new TreeNode(3);
        node1.right = node3;
        TreeNode node4 = new TreeNode(4);
        node2.left = node4;
        TreeNode node5 = new TreeNode(5);
        node2.right = node5;
        
        print(node1);
        
        ICloneBinaryTree cbt = new CloneBinaryTree();
        TreeNode newTree = cbt.cloneTree(node1);
        print(newTree);
    }
    
    public static void print(TreeNode root){
        if (root == null) {
            return ;
        }
        System.out.println(root.val);
        print(root.left);
        print(root.right);
    }
}
